package com.wanma.tcp;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class UdpServer {
	public static void main(String[] args) throws IOException {
		System.out.println("udp 服务器启动.......");
		int port = 8080;
		DatagramSocket ds  = new DatagramSocket(port);
		byte[] buf = new byte[1024];
		DatagramPacket dp = new DatagramPacket(buf, buf.length);
		ds.receive(dp);
		String str = new String(dp.getData(),0,dp.getLength());
		System.out.println("客户端发送的数据是："+str);
		ds.close();
	}
}
